package com.itboye.pondteam.pondteam;

import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.pondteam.R;
import com.itboye.pondteam.adapter.WeiShiAdapter;
import com.itboye.pondteam.base.BaseActivity;
import com.itboye.pondteam.bean.WeiShiModel;
import com.itboye.pondteam.custom.XAlertDialog;
import com.itboye.pondteam.interfaces.IRecyclerviewclicklistener;
import com.itboye.pondteam.utils.loadingutil.MAlert;

import java.util.ArrayList;

public class ActivityChaZuoBDetail extends BaseActivity implements IRecyclerviewclicklistener, XAlertDialog.OnEditInputFinishedListener {

    RecyclerView recyclerview;
    TextView txt_title;
    ImageView img_back;
    ImageView img_add_weishi;
    private XAlertDialog xAlertDialog;
    ImageView chazuoB_kaiguan,chazuoB_weishi;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cha_zuo_bdetail);
        txt_title.setText(getIntent().getStringExtra("title"));
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        recyclerview.setLayoutManager(linearLayoutManager);
        DividerItemDecoration dividerItemDecoration =
                new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
        recyclerview.addItemDecoration(dividerItemDecoration);
        ArrayList<WeiShiModel> weiShiModelArrayList = new ArrayList<>();
        for (int i = 0; i < 1200; i++) {
            WeiShiModel weishi = new WeiShiModel();
            weishi.setNickName("喂食");
            weishi.setType(1);//设置侧滑类型
            weiShiModelArrayList.add(weishi);
        }
        WeiShiAdapter adapter = new WeiShiAdapter(weiShiModelArrayList, this);
        recyclerview.setAdapter(adapter);
    }


    @Override
    public void onClick(View v) {
        int i = v.getId();
        if (i == R.id.img_back) {
            finish();

        } else if (i == R.id.img_add_weishi) {
            xAlertDialog = new XAlertDialog(this, this);
//                xAlertDialog.create();
            xAlertDialog.show();

        }else if (i == R.id.chazuoB_kaiguan) {

        }else if (i == R.id.chazuoB_weishi) {

        }
    }

    @Override
    public void onItemClick(String str) {

    }

    @Override
    public void onLeftMenuClick(String str) {

    }

    @Override
    public void onRightMenuClick(String str) {
        MAlert.alert(str);
    }

    @Override
    public void editInputFinished(String password) {
        MAlert.alert(password);
        xAlertDialog.dismiss();
    }
}
